package org.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;
import org.example.pojo.ItripHotelPaidListingRecommend;
import org.example.vo.recommend.paidlisting.Recommend_PaidListing;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ItripHotelPaidListingRecommendMapper extends BaseMapper<ItripHotelPaidListingRecommend> {
    @Select("select ih.id,ihpr.recommendOrder from itrip_hotel_paidlisting_recommend ihpr inner join itrip_hotel ih on ihpr.hotelId = ih.id\n" +
            "where ih.redundantCityName = #{city}\n" +
            "order by ihpr.recommendOrder")
    @Results({
            @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true),
            @Result(column="recommendOrder", property="recommendOrder", jdbcType= JdbcType.INTEGER)
    })
    List<Recommend_PaidListing> queryOrderAsc(String city);
}
